<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    //临时存储的数据 (库房中存储的数据)
    let persons = [
        { "username": "xiaoming1", "password": "1111" },
        { "username": "xiaoming2", "password": "222" },
        { "username": "xiaoming3", "password": "33333" },
    ]
    //通过文本框获取的数据内容(表单提交的数据) 
    let user = { username: "zhangsan", password: "678809" }

    let reg = persons.findIndex((item) => {
        return item.username == user.username && item.password == user.password
    })

    //判断是否用户已被注册
    if (reg == -1) {
        //该用户没有被注册
        alert("该用户未注册")
    }
    else {
        alert("该用户已被注册，请直接登录");
        //跳转
        window.location.href = "./01登录.html";
    }

</script>